import type { User } from "./index";

export const users: User[] = [
    {
        id: "1",
        email: "simonmecho@gmail.com",
        name: "Simon",
        password: "Aa123456",
    },
    {
        id: "2",
        email: "terry@jinnengine.com",
        name: "Terry",
        password: "Aa123456",
    },
    {
        id: "3",
        email: "xiao@jinnengine.com",
        name: "Xiao",
        password: "Aa123456",
    },
    {
        id: "4",
        email: "vip@jinnengine.com",
        name: "VIP",
        password: "Aa123456",
    },
];

export const login = (email: string, password: string) => {
    return users.find(
        (user) =>
            (user.email === email || user.name === email) &&
            user.password === password
    );
};
